package logic

import (
	"context"
	"srv/model/mysql"

	"srv/internal/svc"
	"srv/rent"

	"github.com/zeromicro/go-zero/core/logx"
)

type DetailsGoodsLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewDetailsGoodsLogic(ctx context.Context, svcCtx *svc.ServiceContext) *DetailsGoodsLogic {
	return &DetailsGoodsLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *DetailsGoodsLogic) DetailsGoods(in *rent.DetailsGoodsRequest) (*rent.DetailsGoodsResponse, error) {
	// todo: add your logic here and delete this line
	g := mysql.Goods{}
	err := g.DetailsGoods(int(in.GoodsId))
	if err != nil {
		logx.Error("商品详情失败:", err)
		return nil, err
	}

	return &rent.DetailsGoodsResponse{}, nil
}
